import KiRequest from "./request";
import localCache from '@/utils/cache'
const kiRequest = new KiRequest({
  baseURL: 'http://116.62.121.100:8999',
  interceptors: {
    requestSuccessInterceptor(config) {
      const token = localCache.getCache('token')
      if (token && config.headers) {
        config.headers.Authorization = `Bearer ${token}` 
      }
      return config
    },
    requestErrorInterceptor(err) {
      
    },
    responseSuccessInterceptor(res) {
      return res.data
    },
    responseErrorInterceptor(err) {
      
    }
  }
})

export default kiRequest